/* Makefile for dynodump subdirectory in XEmacs
   Copyright (C) 1995 Board of Trustees, University of Illinois

This file is part of XEmacs.

XEmacs is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.

XEmacs is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with XEmacs; see the file COPYING.  If not, write to the Free
Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */

/* Avoid trouble on systems where the `SHELL' variable might be
   inherited from the environment. */
SHELL = /bin/sh

/* Some people use these in paths they define.  We don't want their paths
   getting changed on them. */
#undef sparc
#undef sun
#undef unix
#undef i386
#undef ppc
#undef sgi

/* ==================== Things `configure' will edit ==================== */

CC=@CC@
CFLAGS=@CFLAGS@
ARCH=@dynodump_arch@

/* Where to find the source code.  This is set by the configure
   script's `--srcdir' option.  However, the value of ${srcdir} in
   this makefile is not identical to what was specified with --srcdir,
   since the variable here has `/dynodump' added at the end. */
srcdir=@srcdir@
VPATH=@srcdir@

/* ========================= start of cpp stuff ========================= */

#define NO_SHORTNAMES
#define THIS_IS_YMAKEFILE
#define NOT_C_CODE
#include "../src/config.h"

#ifdef USE_GCC
# define PIC_ARG -fpic
#else
# define PIC_ARG -K pic
#endif

INCLUDES = -I${srcdir} -I${srcdir}/$(ARCH)
ALL_CFLAGS = ${CFLAGS} PIC_ARG ${INCLUDES}
OBJS = _relocate.o dynodump.o syms.o

.c.o:
	$(CC) -c $(ALL_CFLAGS) $<

/* If we don't need dynodump, then don't do anything. */
#ifdef DYNODUMP
all:: dynodump.so
#else
all::
#endif

dynodump.so: ${srcdir}/_dynodump.h $(OBJS)
	$(CC) -o dynodump.so -G $(OBJS) -lelf

_relocate.o: ${srcdir}/$(ARCH)/_relocate.c ${srcdir}/$(ARCH)/machdep.h
	$(CC) -c $(ALL_CFLAGS) ${srcdir}/$(ARCH)/_relocate.c

mostlyclean:
	-rm -f *.o \#*

clean: mostlyclean
	-rm -f *.so *.so.1

distclean: clean
	-rm -f Makefile Makefile.in

realclean: distclean
	rm -f TAGS

versionclean:
	true

extraclean: realclean
	-rm -f *~ \#*
